'''
print("\n","="*10,"蚂蚁庄园动态","="*10)
file=open("message.txt","w")
file.write("你使用了1张加速卡，小鸡撸起袖子开始双手吃饮料，进食速度大大加快。\n")
print("\n 写入了一条动态……\n")
file.close()
'''

print("\n","="*10,"采用a追加文本","="*10)
file=open("message.txt","a")
file.write("增加一行文件")
file.close()
file=open("message.txt","r")
m=file.read()
print(m)

print("\n","="*10,"逐行显示文本","="*10)
with open("message.txt","r") as file:
    number=0
    while True:
        number+=1
        line =file.readline()
        if line =="":
            break
        print("文本行",number,line,end="\n")
    print("\n","="*39,"over","="*39,"\n")
